package com.icomvn.game.pikachu.utility;

import java.util.Random;

public class Utility {
	public static int result[]= new int[96];
	public static int[] getRandomSession_4(int num) {
		result=new int[num];
		for(int i=0;i<num/2;i++){
			result[i]=(i)%24+1;
			result[i+num/2]=result[i];
		}
		mixResult();
		return result;
	}
	public static int[] getRandomSession_6(int num) {
		result=new int[num];
		for(int i=0;i<num/2;i++){
			result[i]=(i)%16+1;
			result[i+num/2]=result[i];
		}
		mixResult();
		return result;
	}
	public static void mixResult(){
		int mid[]=getRandom(result.length,result.length);
		int midAccess[]=new int[result.length];
		for(int i=0;i<result.length;i++){
			midAccess[i]=result[mid[i]];
		}
		result=midAccess;
	}
	public static int[] getRandom(int sum, int select) {
		int count = 0;
		Random random = new Random();
		int result[] = new int[select];
		while (count < select) {
			int mid = random.nextInt(sum) % sum;
			boolean xd = false;
			if (count > 0)
				for (int i = 0; i < count; i++) {
					if (mid == result[i]) {
						xd = true;
						break;
					}
				}
			if (xd == false) {
				result[count] = mid;
				count++;
			}
		}
		return result;
	}
}
